﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FATCATool
{
    public partial class DocSpecControl : UserControl
    {
        private DocSpec_Type _docSpec;

        public DocSpecControl()
        {
            InitializeComponent();
        }

        public void Intitalize(DocSpec_Type docSpec)
        {
            _docSpec = docSpec;
            DataBind();
        }

        private void DataBind()
        {            
            cmbDocType.DataBindings.Clear();
            cmbDocType.DataSource = FATCA_OECD.GetFriendlyEnumList(typeof(FatcaDocTypeIndic_EnumType));
            cmbDocType.ValueMember = "Key";
            cmbDocType.DisplayMember = "Value";
            cmbDocType.DataBindings.Add("SelectedItem", _docSpec, "DocTypeIndic");

            txtDocRefId.DataBindings.Clear();
            txtDocRefId.DataBindings.Add("Text", _docSpec, "DocRefId");

            txtCorrMessageRefId.DataBindings.Clear();
            txtCorrMessageRefId.DataBindings.Add("Text", _docSpec, "CorrMessageRefId");

            txtCorrDocRefId.DataBindings.Clear();
            txtCorrDocRefId.DataBindings.Add("Text", _docSpec, "CorrDocRefId");

        }
    }
}
